package com.example.sps.config;

import com.example.sps.properties.AliOssProperties;
import com.example.sps.utils.AliossUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @ProjectName: Sps
 * @Titile: OssConfig
 * @Author: nency
 * @Description: TODO
 */
@Configuration
public class OssConfig {
    @Bean
    @ConditionalOnMissingBean
    public AliossUtils aliossUtils(AliOssProperties aliOssProperties){
        return new AliossUtils(aliOssProperties.getEndpoint(),
                aliOssProperties.getAccessKeyId(),
                aliOssProperties.getAccessKeySecret(),
                aliOssProperties.getBucketName());
    }
}
